package servlet;

import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;

@WebServlet(urlPatterns = "/home4_2")
public class HomeWork4_2 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ServletOutputStream outputStream = resp.getOutputStream();
        byte[] binary = "2023022026".getBytes();
        outputStream.write("学号2023022026的二进制为：".getBytes());
        outputStream.print(Arrays.toString(binary));
        outputStream.flush();
        outputStream.close();
    }
}
